
package dieci.managers.ordermanager;

import dieci.database.order.OrderHibernateDAO;
import dieci.system.Order;
import dieci.system.Supplier;
import java.util.Date;
import java.util.List;

/**
 *
 * @author DuckSys
 */
public class OrderManager {

    public OrderManager()
    {
        this.orderDAO = new OrderHibernateDAO();
    }

    public void saveOrder(Order order)
    {
        //call prod dao to save the order in db
        orderDAO.saveOrUpdate(order);        
    }

    
    public void deleteOrder(Order order)
    {
        orderDAO.delete(order);
    }

    public Order find(long orderId)
    {
        return orderDAO.findByOrderId(orderId);
    }
    
    public List<Order> list()
    {
        return orderDAO.list();
    }
    
    public List<Order> findByDateRange(Date from, Date end)
    {
        return orderDAO.findByOrderDateRange(from,end);
    }
    
    public List<Order> findBySupplier(String supplierName)
    {
        return orderDAO.findBySupplierName(supplierName);
    }
    private OrderHibernateDAO orderDAO;
}
